#include "common.h"

struct mylnode;
struct mylnode {
    struct mylnode *pre;
    struct mylnode *next;
    void *data;
};
typedef struct mylnode mylnode;

typedef struct {
    mylnode *head;
    int size;
    int capacity;
    cmp_t cmp;
} mylist;

#define MYLIST_IS_FULL(l) (l->size == l->capacity)
#define MYLIST_IS_EMPTY(l) (l->size == 0)

mylist *mylist_create(int c, cmp_t cmp);
int mylist_append(mylist *l, void *d);
int mylist_insert_at(mylist *l, void *d, int pos);
void mylist_delete(mylist *l, mylnode *n);
mylnode *mylist_delete_at(mylist *l, int pos);
mylnode *mylist_find(mylist *l, void *d);
mylnode *mylist_find_at(mylist *l, int pos);
